<?php
	$this->partial('nav_menu');

	$class = '';
	if (FreshRSS_Context::$user_conf->hide_read_feeds &&
			FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) &&
			!FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
		$class = ' state_unread';
	}
?>

<div id="stream" class="global<?php echo $class; ?>">
<?php
	$params = Minz_Request::fetchGET();
	unset($params['c']);
	unset($params['a']);
	$url_base = array(
		'c' => 'index',
		'a' => 'normal',
		'params' => $params,
	);

	foreach ($this->categories as $cat) {
		$feeds = $cat->feeds();
		$url_base['params']['get'] = 'c_' . $cat->id();

		if (!empty($feeds)) {
?>
	<div class="box category" data-unread="<?php echo $cat->nbNotRead(); ?>">
		<div class="box-title"><a class="title" data-unread="<?php echo format_number($cat->nbNotRead()); ?>" href="<?php echo Minz_Url::display($url_base); ?>"><?php echo $cat->name(); ?></a></div>

		<ul class="box-content">
			<?php
				foreach ($feeds as $feed) {
					$nb_not_read = $feed->nbNotRead();
					$error = $feed->inError() ? ' error' : '';
					$empty = $feed->nbEntries() === 0 ? ' empty' : '';
					$url_base['params']['get'] = 'f_' . $feed->id();
			?>
			<li id="f_<?php echo $feed->id(); ?>" class="item feed<?php echo $error, $empty, $feed->mute() ? ' mute' : ''; ?>" data-unread="<?php echo $feed->nbNotRead(); ?>" data-priority="<?php echo $feed->priority(); ?>">
				<img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" />
				<a class="item-title" data-unread="<?php echo format_number($feed->nbNotRead()); ?>" href="<?php echo Minz_Url::display($url_base); ?>"><?php echo $feed->name(); ?></a>
			</li>
			<?php } ?>
		</ul>
	</div>
<?php
		}
	}
?>
</div>

<div id="overlay">
	<a class="close" href="#"><?php echo _i('close'); ?></a>
</div>
<div id="panel"<?php echo FreshRSS_Context::$user_conf->display_posts ? '' : ' class="hide_posts"'; ?>>
</div>
